import request from '../../utils/request';
import {download} from '../../utils/commons'
const R=require("ramda");
/**
 * 查询订单利润
 * @param beginDate	提交时间
 * @param endDate	提交时间
 * @param contractNo	订单协议号
 * @param cstName	客户名称
 * @param isCost	资金成本
 * @param percent	年化利率
 * @param days		垫资天数
 * @param providerPage	分页对象
 */
export async function queryOrderBenefit({beginDate, endDate,contractNo, cstName, isCost, percent, days, page}) {
    return request(apiPath.imagent + "/api/report/order/benefit",
        {
            method: 'get',
            data: {beginDate: beginDate, endDate: endDate, contractNo: contractNo, cstName: cstName, isCost: isCost, percent: percent, days: days, page: page.page, size: page.size}
        });
}


/**
 * 导出订单利润
 * @param lesseesCode
 * @param beginTime
 * @param endTime
 */
export async function generateOrderBenefit({beginDate, endDate,contractNo, cstName, isCost, percent, days}) {
    let url =  apiPath.imagent + "/api/report/order/benefit/generate";
    let data={};
    beginDate=R.isNil(beginDate)?'':beginDate;
    endDate=R.isNil(endDate)?'':endDate;
    contractNo=R.isNil(contractNo)?'':contractNo;
    cstName=R.isNil(cstName)?'':cstName;
    isCost=R.isNil(isCost)?'':isCost;
    percent=R.isNil(percent)?'':percent;
    days=R.isNil(days)? '': days;

    data={beginDate: beginDate, endDate: endDate, contractNo: contractNo, cstName: cstName, isCost: isCost, percent: percent, days: days, filename: '订单利润表'}
    download(url, data);
}



